package com.weilian.ordering.common;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONException;

import android.content.Context;
import android.content.SharedPreferences;

public class Preferences {
	private Context context;
	SharedPreferences settings;
	SharedPreferences.Editor editor;
	private static Preferences instance;
	private static String NAME = "weilian";
	
	public static Preferences getInstance(Context context){
		if(instance==null){
			instance = new Preferences(context);
		}
		return instance;
	}
	private Preferences(Context context){
		this.context = context;
		settings = this.context.getSharedPreferences(NAME, 0);
		editor = settings.edit();
	}
	
	//save 
	public void setScreenSave(int time){
		editor.putInt("screentime", time);
		editor.commit();
	}
	
	public int getScreenSave(){
		return settings.getInt("screentime", 10);
	}
	
	//试用标识 
	public void setTest(boolean flag){
		editor.putBoolean("test", flag);
		editor.commit();
	}
	
	public boolean getTest(){
		return settings.getBoolean("Test", false);
	}
	
}
